
clear,clc;
T=0.02; 
[h]=textread('comdata_h1.txt','%d')';
t=0:T:T*(length(h)-1);

% fun1 = @(p,x)p(1)*sin(p(2)*x+p(3))+p(4);
% p0=[0.008,0.01,0.01,-1];
% p=lsqcurvefit(fun1,p0,t,h);
% plot(t,h,'.',t,fun1(p,t),'black');

p=polyfit(t,h,1);
plot(t,h,'.',t,polyval(p,t),'black');